home *** CD-ROM | disk | FTP | other *** search
- ;void restore_box_b(box,top_x,top_y,width,depth);
- ; unsigned char *box,top_x,top_y,width,depth;
-
- EXTRN _memory_model:byte
- EXTRN _video_page:byte
-
- _TEXT SEGMENT BYTE PUBLIC 'CODE'
- ASSUME CS:_TEXT
- PUBLIC _restore_box_b
- _restore_box_b proc near
- cld ;set direction flag
- push bp ;
- mov bp,sp ;set stack frame
- push di ;
- push si ;
- cmp _memory_model,0 ;near or far?
- jle begin ;jump if near
- inc bp ;else add 2 to BP
- inc bp ;
- begin: push ds ;
- mov bh,_video_page ;set video page
- cmp _memory_model,2 ;data near or far?
- jb L0 ;jump if near
- lds si,dword ptr[bp+4] ;DS:SI pts to byte array
- add bp,2 ;inc BP for dword ptr
- jmp short L00 ;jump ahead
- L0: mov si,[bp+4] ;near case
- L00: mov dl,[bp+6] ;topleft column in DL
- dec dl ;count from 0
- mov dh,[bp+8] ;topleft row in DH
- dec dh ;count from 0
- mov al,[bp+10] ;width in AL
- mov ah,[bp+12] ;depth in AH
- mov bp,ax ;copy in BP
- sub cx,cx ;clear CX
- mov cl,al ;copy width into CX
- mov di,cx ;move to DI as counter
- mov ah,2 ;function to set cursor
- int 10h ;set the cursor
- push dx ;save start-of-row pos
- L1: lodsw ;get char and attri
- mov bl,ah ;move attribute to BL
- mov ah,9 ;func to write char-attri
- mov cx,1 ;number of chars to write
- int 10h ;write the char
- dec di ;decrement width counter
- jz L3 ;to next row if last col
- inc dl ;incre cursor col
- L2: mov ah,2 ;function to set cursor
- int 10h ;reset the cursor
- jmp short L1 ;go do next character
- L3: pop dx ;new row: get old pos
- mov cx,bp ;width-depth to CX
- dec ch ;decre depth counter
- jz L4 ;quit if finished
- mov bp,cx ;resave depth-width
- sub ch,ch ;CX = width
- mov di,cx ;transfer to DI as ctr
- inc dh ;increase row number
- push dx ;save for next time
- jmp short L2 ;go set cursor to nxt row
- L4: pop ds ;
- pop si ;
- pop di ;
- pop bp ;
- cmp _memory_model,0 ;quit
- jle quit ;
- db 0CBh ;RET far
- quit: ret ;RET near
- _restore_box_b endp
- _TEXT ENDS
- END